package com.wodsy.phoenix.dataservice.base;

import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

/**
 * 名称：com.wodsy.orderc.dataservice.service.base
 * 描述：<br>
 * 类型：JAVA<br>
 * 最近修改时间：28/02/2015 11:03<br>
 *
 * @author Jack Chan
 * @since 28/02/2015
 */
public interface BaseService<M extends Serializable, PK extends Serializable> {
    @Transactional
    public M get(PK pk);

    @Transactional(rollbackFor=Exception.class)
    void save(M obj);

    @Transactional(rollbackFor=Exception.class)
    void update(M ojb);

    @Transactional(rollbackFor=Exception.class)
    void delete(M obj);

    @Transactional(rollbackFor=Exception.class)
    void saveOrUpdate(M obj);

    @Transactional(readOnly=true)
    List<M> findByAll();

    @Transactional(readOnly=true)
    M findByProperty(String propertyName, Object value);

    @Transactional(readOnly=true)
    List<M> findAllByProperty(String propertyName, Object value);
}
